package com.sunny.entity;

import javax.persistence.*;
import java.sql.Timestamp;

/**
 * @Author: sublun
 * @Date: 2021/3/18 17:56
 */
@Entity
@Table(name = "sun_site", schema = "crawler", catalog = "")
public class SunSiteEntity {
    private long siteId;
    private String baseUrl;
    private String siteName;
    private Byte isCollected;
    private Timestamp lastCollectedTime;
    private Timestamp addTime;
    private Long addUser;

    @Id
    @Column(name = "site_id")
    public long getSiteId() {
        return siteId;
    }

    public void setSiteId(long siteId) {
        this.siteId = siteId;
    }

    @Basic
    @Column(name = "base_url")
    public String getBaseUrl() {
        return baseUrl;
    }

    public void setBaseUrl(String baseUrl) {
        this.baseUrl = baseUrl;
    }

    @Basic
    @Column(name = "site_name")
    public String getSiteName() {
        return siteName;
    }

    public void setSiteName(String siteName) {
        this.siteName = siteName;
    }

    @Basic
    @Column(name = "is_collected")
    public Byte getIsCollected() {
        return isCollected;
    }

    public void setIsCollected(Byte isCollected) {
        this.isCollected = isCollected;
    }

    @Basic
    @Column(name = "last_collected_time")
    public Timestamp getLastCollectedTime() {
        return lastCollectedTime;
    }

    public void setLastCollectedTime(Timestamp lastCollectedTime) {
        this.lastCollectedTime = lastCollectedTime;
    }

    @Basic
    @Column(name = "add_time")
    public Timestamp getAddTime() {
        return addTime;
    }

    public void setAddTime(Timestamp addTime) {
        this.addTime = addTime;
    }

    @Basic
    @Column(name = "add_user")
    public Long getAddUser() {
        return addUser;
    }

    public void setAddUser(Long addUser) {
        this.addUser = addUser;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        SunSiteEntity that = (SunSiteEntity) o;

        if (siteId != that.siteId) return false;
        if (baseUrl != null ? !baseUrl.equals(that.baseUrl) : that.baseUrl != null) return false;
        if (siteName != null ? !siteName.equals(that.siteName) : that.siteName != null) return false;
        if (isCollected != null ? !isCollected.equals(that.isCollected) : that.isCollected != null) return false;
        if (lastCollectedTime != null ? !lastCollectedTime.equals(that.lastCollectedTime) : that.lastCollectedTime != null)
            return false;
        if (addTime != null ? !addTime.equals(that.addTime) : that.addTime != null) return false;
        if (addUser != null ? !addUser.equals(that.addUser) : that.addUser != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = (int) (siteId ^ (siteId >>> 32));
        result = 31 * result + (baseUrl != null ? baseUrl.hashCode() : 0);
        result = 31 * result + (siteName != null ? siteName.hashCode() : 0);
        result = 31 * result + (isCollected != null ? isCollected.hashCode() : 0);
        result = 31 * result + (lastCollectedTime != null ? lastCollectedTime.hashCode() : 0);
        result = 31 * result + (addTime != null ? addTime.hashCode() : 0);
        result = 31 * result + (addUser != null ? addUser.hashCode() : 0);
        return result;
    }
}
